// 车险订单 商险投保方案反序
import { syCode, labelConf } from '@/components/ivew_conf/car_sy_plan'

export default (ctx, next) =>{
    let syRisk = ctx.params.DEVsyRiskTable;
    let cache = []
    
    syRisk.forEach(item =>{

        if(item.checked){

            let reverseItem = {
                name: item.name,
                code: syCode[item.key],
                insuredAmount: item.value,
                noInsuranceExclusions: item.jp,
                notes: ''
            };

            if(item.key === 'boLi'){
                reverseItem.insuredAmount = 0;
                reverseItem.notes = item.value;
            }
            
            cache.push(reverseItem)
        }
        
    })

    ctx.params.DEVsyRiskTable = cache;
    
    next()

}